package com.ele.service;

import java.sql.SQLException;
import java.util.List;

import com.ele.dao.FoodDao;
import com.ele.pojo.Food;
import com.ele.pojo.Shop;

public class FoodService {
	/**
	 * 	添加菜品数据处理
	 * @param food
	 * @return
	 */
	public Integer addFood(Food food) {
		FoodDao dao = new FoodDao();
		try {
			return dao.addFood(food);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return 0;
	}
	/**
	 * 	查询所有菜品数据处理
	 * @param shop
	 * @return
	 */
	public List<Food> selectFood(Shop shop) {
		FoodDao dao = new FoodDao();
		try {
			return dao.selectFood(shop);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
		
	}
	/**
	 * 	查询某菜品数据处理
	 * @param shop
	 * @param name
	 * @return
	 */
	public List<Food> selectFood(Shop shop, String name) {
		FoodDao dao = new FoodDao();
		try {
			return dao.selectFood(shop,name);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
		
	}
	public Food selectFood(Shop shop, Integer id) {
		FoodDao dao = new FoodDao();
		try {
			return dao.selectFood(shop,id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
		
	}
	public int updateFood(Food food) {
		return 0;
	}

}
